<template>
	<view class="black">
		<image :src="imgurl" mode=""
		@longpress="opetimg"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgurl:""
			}
		},
		methods: {
			opetimg(){
				var me =this
				uni.showActionSheet({
				    itemList: ['保存图片'],
				    success: function (res) {
				        if(res.tapIndex == 0){
							uni.showLoading({
								title:"图片保存中"
							})
							uni.downloadFile({
								url:me.imgurl,
									
								success:res=>{
									uni.hideLoading()
									var temppath = res.tempFilePath
									console.log(temppath)
									uni.saveImageToPhotosAlbum({
										filePath:temppath,
										success(res) {
											uni.showToast({
												title:"保存成功",
												duration:2000
											})
										}
									})
								}
							})
						}
				    },
				    fail: function (res) {
				        console.log(res.errMsg);
				    }
				});
			}
		},
		onLoad(e) {
			console.log(e)
			this.imgurl = e.cover
			uni.setNavigationBarColor({
				frontColor:"#FFFFFF",
				backgroundColor:"#000000"
			})
		},
		
	}
</script>

<style>
.black{
	width: 100%;
	height: 100vh;
	background-color: black;
	display: flex;
	
}
	
.black image{
	align-self: center;
	width: 100%;
}
</style>
